home *** CD-ROM | disk | FTP | other *** search
- import java.applet.Applet;
- import java.awt.BorderLayout;
- import java.awt.Button;
- import java.awt.Color;
- import java.awt.Container;
- import java.awt.Event;
- import java.awt.FlowLayout;
- import java.awt.GridLayout;
- import java.awt.Label;
- import java.awt.Panel;
-
- public class ThreadX extends Applet {
- AnimationPanel panelOne;
- AnimationPanel panelTwo;
- AnimationPanel panelThree;
- Panel animationArea;
- Panel mainButtonPanel;
- Button aStartButton;
- Button aStopButton;
- Button resetButton;
- Label label1;
-
- public void init() {
- ((Container)this).setLayout(new BorderLayout(0, 0));
- ((Panel)this).addNotify();
- ((Applet)this).resize(500, 280);
- this.animationArea = new Panel();
- this.animationArea.setLayout(new FlowLayout(1, 5, 5));
- this.animationArea.resize(this.animationArea.preferredSize());
- this.animationArea.move(28, 6);
- ((Container)this).add("Center", this.animationArea);
- this.mainButtonPanel = new Panel();
- this.mainButtonPanel.setLayout(new FlowLayout(1, 5, 5));
- this.mainButtonPanel.resize(this.mainButtonPanel.preferredSize());
- this.mainButtonPanel.move(28, 172);
- ((Container)this).add("South", this.mainButtonPanel);
- this.aStartButton = new Button("All Start");
- this.aStartButton.resize(this.aStartButton.preferredSize());
- this.aStartButton.move(76, 200);
- this.mainButtonPanel.add(this.aStartButton);
- this.aStopButton = new Button("All Stop");
- this.aStopButton.resize(this.aStopButton.preferredSize());
- this.aStopButton.move(198, 200);
- this.mainButtonPanel.add(this.aStopButton);
- this.resetButton = new Button("Reset");
- this.resetButton.resize(this.resetButton.preferredSize());
- this.resetButton.move(318, 200);
- this.mainButtonPanel.add(this.resetButton);
- this.label1 = new Label("label");
- this.label1.reshape(262, 110, 103, 49);
- ((Container)this).add(this.label1);
- this.animationArea.setLayout(new GridLayout(1, 3));
- this.animationArea.add(this.panelOne = new AnimationPanel(Color.red, 75));
- this.animationArea.add(this.panelTwo = new AnimationPanel(Color.white, 100));
- this.animationArea.add(this.panelThree = new AnimationPanel(Color.blue, 125));
- super.init();
- }
-
- public boolean handleEvent(Event event) {
- if (event.id == 1001 && event.target == this.resetButton) {
- this.Reset();
- return true;
- } else if (event.id == 1001 && event.target == this.aStopButton) {
- this.AllStop();
- return true;
- } else if (event.id == 1001 && event.target == this.aStartButton) {
- this.AllStart();
- return true;
- } else {
- return super.handleEvent(event);
- }
- }
-
- public void AllStart() {
- this.panelOne.StartAnimation();
- this.panelTwo.StartAnimation();
- this.panelThree.StartAnimation();
- }
-
- public void AllStop() {
- this.panelOne.StopAnimation();
- this.panelTwo.StopAnimation();
- this.panelThree.StopAnimation();
- }
-
- public void Reset() {
- this.panelOne.ResetAnimation();
- this.panelTwo.ResetAnimation();
- this.panelThree.ResetAnimation();
- }
- }
-